package com.maxuxu.scihome.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @className: FileStaticConfig
 * @author: Maxuxu
 * @date: 2022/7/5 23:15
 * @description:
 */

@Configuration
public class FileStaticConfig implements WebMvcConfigurer {
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        // 如果访问资源 需要添加 /source/ , 后面跟上文件名，比如 http://localhost:8080/source/1.jpg
        registry.addResourceHandler("/document/download/source/**").addResourceLocations("file:"+"d:/test/file/");
    }
}